﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Web
{
    public class BaseController : Controller
    {
        protected override void OnActionExecuted(ActionExecutedContext filterContext) {
            base.OnActionExecuted(filterContext);
            var cookie = this.Request.Cookies["theme"];
            string theme = "";
            if (cookie == null || string.IsNullOrEmpty(cookie.Value)) {
                theme = "default";
                Response.Cookies.Add(new System.Web.HttpCookie("theme", theme));
            }
            else { theme = cookie.Value; }
            ViewBag.Theme = theme;
        }

    }
}